class Versions extends HtmlNode{
    constructor(versions) {
        super('td[width=200px].layui-row');
        //创建标题
        this.title=new HtmlNode('label.layui-form-label.layui-col-md4',this)
        this.title.textContent='版本'
        //创建下拉列表
        this.versionsEl=new HtmlNode('select',new HtmlNode('.layui-input-inline.layui-col-md6',this))
        this.versions=[]
        if(versions){
            versions.forEach(v=>this.appendVersion(v))
        }
        Object.defineProperty(this,"selectVersion",{
            enumerable:true,
            configurable:true,
            get(){
                return this.versions[this.versionsEl.el.selectedIndex]
            }
        })
    }

    appendVersion(version){
        this.versions.push(version)
        this.versionsEl.appendChild(version)
    }
}